package com.ruoyi.web.controller.teacher;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.teacher.domain.Review;
import com.ruoyi.teacher.mapper.ReviewRepository;
import com.ruoyi.teacher.service.ReviewSevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/system")
public class ReviewController {

    @Autowired
    private ReviewSevice reviewSevice;


    @GetMapping("/review/list")
    public TableDataInfo getList(HttpServletRequest request) {
        String pageNum = request.getParameter("pageNum");
        String pageSize = request.getParameter("pageSize");
        int Num = Integer.parseInt(pageNum);
        int Size = Integer.parseInt(pageSize);
        return reviewSevice.getPage(Num, Size);
    }

    @PutMapping("/review")
    public AjaxResult getUpdate(@RequestBody Review review) {
        reviewSevice.getAdd(review);
        return AjaxResult.success();
    }
}
